package com.zkjl.protect_business.controller;

import com.zkjl.protect_business.common.ApiResponse;
import com.zkjl.protect_business.common.SystemLog;
import com.zkjl.protect_business.dto.PageBaseDTO;
import com.zkjl.protect_business.dto.SortDTO;
import com.zkjl.protect_business.entity.Log;
import com.zkjl.protect_business.service.LogService;
import com.zkjl.protect_business.utils.ResultUtil;
import com.zkjl.protect_business.vo.NoticeVO;
import com.zkjl.protect_business.vo.PageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/logs")
@Api(tags = {"日志"})
public class LogController {

    @Autowired
    LogService logService;

    @ApiOperation(value = "日志列表", notes = "日志列表", httpMethod = "GET")
    @GetMapping
    @SystemLog(description = "查看通知列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "logType", value = "日志类型 登录  操作 业务操作" , paramType = "query"),
            @ApiImplicitParam(name = "operationType", value = "操作类型 新增 修改 删除 上传 导出 下载 确认接收 修改密码", paramType = "query")

    })
    public ApiResponse<PageVO<Log>> page(PageBaseDTO pageBaseDTO, SortDTO sortDTO, String logType, String operationType) {

        PageImpl page = logService.page(pageBaseDTO, sortDTO, logType, operationType);

        return ResultUtil.successPagesVO(page);

    }

}
